Skip to content

ci(doop): train S3b — audited lift workflow (CHE-5551) [squash] - #104

Merged
congvc-dev merged 2 commits into
agent/tofu/che-5548-2644b627ca4afrom
agent/x99-claude-sonnet-200k/che-5551-d4fdb0456e80
Nov 23, 2026
Merged

congvc-dev merged 2 commits into
agent/tofu/che-5548-2644b627ca4afrom
agent/x99-claude-sonnet-200k/che-5551-d4fdb0456e80

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

What

CHE-5551, deploy train slice S3b: the audited lift (plan CHE-5474 r5, C-10.6 and C-10.7). Stacked on PR 103 (CHE-5550).

cd-lift.yml is the only way from armed:* or suspended:* back to clear:*. It is dispatch only, with one input, decision_id. The dispatcher must be in vars.DOOP_LIFT_DISPATCHERS. The job runs on cheese-c00-deploy (environment doop-lift, only from cheese/main) under concurrency group c00-deploy-doop and the c00.sh host lock. No step is a human-typed command.

It refuses (marker unchanged, run fails) unless all hold:

  • the decision is doop.deploy_lift v1, approved, by vars.DOOP_LIFT_APPROVER_ID (Cheese), and not withdrawn, rejected, revoked or expired;
  • its marker_value equals the standing marker byte for byte, and its repo is cheese-work/doop;
  • migration quiescence is proven (C-8.8), /healthz answers 200, and the running digest and revision label read;
  • the decision and the marker, re-read under the lock right before the write, still hold.

Then it writes clear:<nonce>:<lift run id>, reads it back, and records lifter, decision id, approver, health, digest, revision and ICT times in the run summary and lift-evidence.json (outcome lifted, refused or failed).

The train switch stays off. DOOP_DEPLOY_TRAIN is not read or written by this workflow (a test asserts it).

Files

  • .github/workflows/cd-lift.yml (new)
  • scripts/deploy-lift.mjs (new): decision read, refusal rules, lift flow, admit and lift CLI
  • scripts/deploy-marker.mjs: lift() and exported readMarker()
  • deploy/cd/c00.sh: new lift command (guard, lock, quiescence, digest, revision label, container health)
  • eslint.config.js: AbortSignal added to the plain-script globals
  • docs: deploy/cd/README.md, .context/TECHSTACK.md, .context/RELEASE.md, comments in cd-deploy.yml

Tests (red, then green)

Written first. Red run before the code existed (12 failed, 34 passed; the rest of the new files failed on a missing module or workflow):

Error: Cannot find module '../scripts/deploy-lift.mjs' imported from tests/deployLift.test.ts
FAIL tests/deployMarker.test.ts > lift (CHE-5551, C-10.7) > writes clear:<nonce>:<lift run id> over exactly the expected suspended value, and reads it back   (TypeError: lift is not a function)
FAIL tests/deployMarker.test.ts > lift ... > readMarker returns the value, null when absent, and throws on anything else   (TypeError: readMarker is not a function)
... Test Files 2 failed (2), Tests 12 failed | 34 passed (46)
c00.sh lift: unknown command; cd-lift.yml: ENOENT (tests/c00Lift.test.ts, tests/deployLiftWorkflow.test.ts)

Green, the command:

npx vitest run tests/deployLift.test.ts tests/deployLiftWorkflow.test.ts tests/c00Lift.test.ts tests/deployMarker.test.ts \
  tests/c00Deploy.test.ts tests/c00Guard.test.ts tests/c00Migrate.test.ts tests/c00Sweep.test.ts tests/deployTrain.test.ts \
  tests/deployWorkflow.test.ts tests/deployEvidence.test.ts tests/cdWatch.test.ts tests/cdWatchWorkflows.test.ts \
  tests/imageWorkflow.test.ts tests/migrationGate.test.ts
→ Test Files 15 passed (15), Tests 653 passed (653)
npx vitest run tests/branchLayout.test.ts tests/mergeProof.test.ts tests/healthzRevision.test.ts tests/approvalAutomations.test.ts
→ Test Files 4 passed (4), Tests 68 passed (68)

Also green: tsgo --noEmit (typecheck), oxlint --type-aware --deny-warnings . (exit 0), eslint on the touched scripts, prettier --check ., bash -n deploy/cd/c00.sh. (shellcheck is not installed on X99.)

Done-when coverage in tests/deployLift.test.ts (92 tests):

Required case Covered by
no decision, unreadable decision (404, non-OK, non-JSON, network error, no token) readDecision and lift refusals
wrong action type; rejected, withdrawn, revoked, expired refusal table (refusalFor) and lift
approver not Cheese (also approver unset) refusal table
marker_value not equal to the marker; repo mismatch refusal table
marker changed during the lift; decision revoked during the lift re-read cases
failed health; unproven quiescence lift, plus c00Lift.test.ts (needs_operator)
accepted case writes clear:* with lift-evidence.json unit and a real CLI subprocess against a local HTTP server
two concurrent lifts serialize, second refused (marker changed) deployLift.test.ts (sequential), c00Lift.test.ts (real flock)

Not proven here (for the S6 drill)

  • The live decision read from the C00 runner. The Multica server is tailnet only. Its reachability from the runner is untested.
  • /healthz URL on C00: default http://127.0.0.1:4400/healthz, overridable with vars.C00_DOOP_HEALTHZ_URL. The port is a guess.
  • A real GitHub App write of the marker (tests use a stand-in for the GitHub API).

Setup needed before the first lift (owner action, not in this repo)

  1. Environment doop-lift must also hold DOOP_MARKER_APP_ID and DOOP_MARKER_APP_KEY. A job takes one environment, and doop-deploy-marker is not provisioned yet.
  2. Repo variables DOOP_LIFT_DISPATCHERS and DOOP_LIFT_APPROVER_ID (Cheese's Multica member id).
  3. Restrict doop-lift to the cheese/main branch. The job also guards the ref in its if:.

Draft. Cross-lab review (x99-codex-terra) is requested on the issue.

Fix round 1 (review item: fail closed on a malformed decision answer)

refusalFor now refuses a decision body that omits withdrawn_at, revoked_at or expires_at (null is still "unset"; an absent key is unreadable decision).

  • Red (3 new cases unreadable decision: no <field> field): Tests 3 failed | 92 passed (95), expected 'lifted' to be 'refused'.
  • Green: bunx vitest run tests/deployLift.test.ts tests/deployLiftWorkflow.test.ts → Tests 114 passed (114); oxlint --deny-warnings, prettier --check and tsgo clean on the touched files.

Stack waiver and head note (22 Nov 2026)

  • Stack link waived by Cheese for PRs 104 and 105 only (Multica comment 01a202ae-dd49-7c7b-87f0-a5448983eb67). Base order stays PR 56, then 104, then 105. No stack 72 link exists.
  • Head 40c8ba73 is a rebase of 68da5b76 onto the new base; the two S3b commits are unchanged (fix commit: 12 lines, 2 files, same on both heads). CI: 11 of 11 checks pass.
  • Gate-path rule unchanged: cross-lab signer x99-codex-terra re-confirms the logic PASS on 40c8ba73 (signed on 68da5b76). PR stays draft until then. DOOP_DEPLOY_TRAIN stays off.

Base automatically changed from agent/x99-claude-sonnet-200k/che-5550-e83936079091 to agent/tofu/che-5548-2644b627ca4a November 20, 2026 22:19
congvc-bot[bot] added 2 commits November 21, 2026 06:13
Add cd-lift.yml, the only way from armed/suspended back to clear (plan CHE-5474
C-10.6, C-10.7). Dispatch only, one input (decision_id), allowlisted dispatcher,
C00 runner under the host deploy lock.

scripts/deploy-lift.mjs refuses unless the Multica decision is an approved
doop.deploy_lift by the configured approver, not withdrawn/revoked/expired, its
marker_value equals the standing marker and repo matches, quiescence and
/healthz are proven, and the decision and marker still hold when re-read right
before the write. It then writes clear:<nonce>:<run id>, reads it back and
records lift-evidence.json. A refusal leaves the marker unchanged.

c00.sh gains a `lift` command (guard, lock, quiescence, digest, revision label,
container health). deploy-marker.mjs gains lift() and exports readMarker().
The train switch DOOP_DEPLOY_TRAIN is not touched.
@congvc-bot-x99
congvc-bot-x99 Bot force-pushed the agent/x99-claude-sonnet-200k/che-5551-d4fdb0456e80 branch from 68da5b7 to 40c8ba7 Compare November 20, 2026 23:16
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review November 22, 2026 10:06
@congvc-dev
congvc-dev merged commit 571a041 into agent/tofu/che-5548-2644b627ca4a Nov 23, 2026
12 checks passed
@congvc-dev
congvc-dev deleted the agent/x99-claude-sonnet-200k/che-5551-d4fdb0456e80 branch November 23, 2026 03:57
congvc-dev pushed a commit that referenced this pull request Nov 23, 2026
…smoke (CHE-5548) [squash] (#56)

* ci(doop): train S4c compat sandbox, isolation probes, env allowlist, sweep, smoke (CHE-5548)

* fix(deploy): real smoke ops, supervised clone migration, probe the sandbox gateway (CHE-5548)

* fix(deploy): bounded quiescence proof and durable needs_operator guard (CHE-5548)

- proveQuiescence: kill, wait, record (pid, backend_start), terminate, prove three
  facts inside one 30 s budget; every step bounded; a timeout leaves a fact unproven.
- Failed migration: clone ledger must equal the pre-migration ledger.
- needs_operator writes a guard file that no sweep removes, keeps the sandbox, skips
  the final sweep. runCompat, c00.sh apply, rollback, sweep and guard refuse until
  the facts hold; lift calls c00.sh guard.
- Tests: stuck docker kill/wait/inspect/psql, later job after a failed proof,
  c00.sh refusal. Run against the previous implementation: 67 of 107 failed.
  Written after the code, so retrospective test-first.

* fix(deploy): persist the needs_operator guard before the clone migration, clear it only after proof (CHE-5548)

Red (6 failures) before the change, green (174 passed across compat and c00 suites) after.

* ci(doop): widen drawingBrowser waits to 30s for loaded runners (CHE-6913)

* test(doop): wait for the element probe before navigating away in pageCanvasBrowser (CHE-6913)

* test(doop): raise the expect.poll default to 30s for loaded runners (CHE-6913)

* test(doop): name the stalled drawingBrowser beforeEach step (CHE-6913)

* test(doop): reload the drawing fixture when Chrome aborts its module imports (CHE-7020)

Chrome aborts in-flight requests with net::ERR_NETWORK_CHANGED when host
network interfaces change. The module script in drawing.html then never sets
window.drawingHarness and no wait recovers. Print pageerror/requestfailed/
readyState on a stall and load the page again (3 tries, 8s ready wait).

* test(doop): give elementPanelBrowser waits 12 s on loaded runners (CHE-7021)

The first seedPanel wait timed out at the 5 s puppeteer default on CI shard 2
(run 44129413615, job 134202011472). Widen the file default and the one
explicit 5 s poll to 12 s, under the 15 s per-test limit.

* ci(doop): smoke routes for agents, custom-providers, image-descriptions, icons, photos (CHE-6841)

* ci(doop): smoke write chains for agents and image descriptions, providers contract (CHE-7697)

* ci(doop): train S5 — readback delay, confirm, rollback, evidence (CHE-5549) [squash] (#99)

* ci(doop): train S5 readback delay, confirm, rollback readback, evidence (CHE-5549)

Rules C-9 and C-12 of CHE-5474. Ships with DOOP_DEPLOY_TRAIN absent or off.

* ci(doop): prove quiescence and decide confirm and rollback under the lock (CHE-5549)

Review round 1 on the S5 slice:
- deploy-gate recheck runs the real quiescence proof (c00.sh quiescence) instead of a hardcoded ok.
- c00.sh confirm and rollback prove migration quiescence under the lock, switch on or off.
- The confirm and rollback checks run inside c00.sh after take_lock, so a newer deployment or a changed marker that
  lands while waiting for the lock is seen (superseded, none, refused); the workflow no longer decides before the lock.
- The rollback job is one c00.sh step; the marker token and suspension follow the step's own go output.

* fix(cd): give readback-confirm the compose dir and Postgres container (CHE-5549)

Quiescence in confirm reads the live database, so the job needs the same
C00_COMPOSE_DIR and C00_PG_CONTAINER as deploy and rollback. Test drives
c00.sh with only each job's own env block.

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>

* ci(doop): train S7 watchers and /healthz revision (CHE-5550) [squash] (#103)

* ci(doop): train S5 readback delay, confirm, rollback readback, evidence (CHE-5549)

Rules C-9 and C-12 of CHE-5474. Ships with DOOP_DEPLOY_TRAIN absent or off.

* ci(doop): prove quiescence and decide confirm and rollback under the lock (CHE-5549)

Review round 1 on the S5 slice:
- deploy-gate recheck runs the real quiescence proof (c00.sh quiescence) instead of a hardcoded ok.
- c00.sh confirm and rollback prove migration quiescence under the lock, switch on or off.
- The confirm and rollback checks run inside c00.sh after take_lock, so a newer deployment or a changed marker that
  lands while waiting for the lock is seen (superseded, none, refused); the workflow no longer decides before the lock.
- The rollback job is one c00.sh step; the marker token and suspension follow the step's own go output.

* fix(cd): give readback-confirm the compose dir and Postgres container (CHE-5549)

Quiescence in confirm reads the live database, so the job needs the same
C00_COMPOSE_DIR and C00_PG_CONTAINER as deploy and rollback. Test drives
c00.sh with only each job's own env block.

* ci(doop): train S7 watchers and /healthz revision (CHE-5550)

* fix(ci): keep the last confirmed deploy durably for the D2 watchers (CHE-5550)

The watchers searched only the 30 newest D2 runs for a confirmed deployment.
After 30 skipped slots the SHA came back null: the live watch then passed an
unreachable /healthz and the freshness watch treated the deployed candidate as
overdue.

- D2's evidence job records each confirmed deploy as a GitHub deployment
  (environment c00-doop, deployments: write), read back before the step passes.
- The last successful D2 SHA is tri-state: known, none (a proven first
  deployment) or unknown. Unknown history alarms and fails visibly.
- Artifact scan is only the fallback: paginated, up to 100 runs, and a green
  run whose evidence is gone counts as unknown.
- /healthz must be healthy with a 40-hex revision even when nothing deployed.

* fix(ci): reconcile the deploy record with newer D2 evidence and send typed booleans (CHE-5550)

A prior deployment record no longer hides a newer confirmed deploy whose own
record write failed: that history is unknown and fails both watchers visibly.
The record carries its D2 run id; auto_merge and production_environment go
out as JSON booleans (gh api -F) and the request and failure path are tested.

* fix(ci): treat a newer D2 run with no evidence as unknown, not skipped (CHE-5550)

* fix(ci): order the last confirmed D2 deploy by confirmation time, not run ID (CHE-8873, CHE-5550)

Round 4 P1: an older run can confirm after a newer run recorded another SHA. Check every run
active at or after the record's confirmation, treat unfinished runs as pending/stuck, record the
confirmation time in the deployment description.

* fix(ci): a pending D2 run no longer hides the 90 min alarm or a failed /healthz (CHE-8873, CHE-5550)

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>

* ci(doop): train S3b — audited lift workflow (CHE-5551) [squash] (#104)

* ci(doop): train S3b — audited lift workflow (CHE-5551)

Add cd-lift.yml, the only way from armed/suspended back to clear (plan CHE-5474
C-10.6, C-10.7). Dispatch only, one input (decision_id), allowlisted dispatcher,
C00 runner under the host deploy lock.

scripts/deploy-lift.mjs refuses unless the Multica decision is an approved
doop.deploy_lift by the configured approver, not withdrawn/revoked/expired, its
marker_value equals the standing marker and repo matches, quiescence and
/healthz are proven, and the decision and marker still hold when re-read right
before the write. It then writes clear:<nonce>:<run id>, reads it back and
records lift-evidence.json. A refusal leaves the marker unchanged.

c00.sh gains a `lift` command (guard, lock, quiescence, digest, revision label,
container health). deploy-marker.mjs gains lift() and exports readMarker().
The train switch DOOP_DEPLOY_TRAIN is not touched.

* fix(ci): lift refuses a decision answer that omits withdrawn_at, revoked_at or expires_at (CHE-5551)

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>

---------

Co-authored-by: congvc-bot[bot] <3634010+congvc-bot[bot]@users.noreply.github.com>
Co-authored-by: congvc-bot-x99[bot] <282619718+congvc-bot-x99[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant